package theOrbalEra.common.network;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;

import net.minecraft.entity.Entity;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.world.World;
import theOrbalEra.common.util.DefultValue;
import theOrbalEra.common.util.OrbalArtsIdList;
import theOrbalEra.common.util.idList.PacketId;

import com.google.common.io.ByteArrayDataInput;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.PacketDispatcher;

public class PacketSpawnFX extends PacketBase {
	public static PacketSpawnFX instance =new PacketSpawnFX();
	public static void spawnFX(int orbalArtsid,double posX,double posY,double posZ,Entity entity){
		ByteArrayOutputStream bos = new ByteArrayOutputStream(110);
		DataOutputStream dos = new DataOutputStream(bos);

		try {
			dos.writeInt(PacketId.FX_SPAWN);
			dos.writeInt(orbalArtsid);
			dos.writeDouble(posX);
			dos.writeDouble(posY);
			dos.writeDouble(posZ);
		} catch (Exception e) {
			e.printStackTrace();
		}

		Packet250CustomPayload pkt = new Packet250CustomPayload();
		pkt.channel = DefultValue.channel;
		pkt.data = bos.toByteArray();
		pkt.length = bos.size();
		pkt.isChunkDataPacket = false;
		PacketDispatcher.sendPacketToAllAround(posX, posY, posZ, 100, entity.dimension, pkt);
		
		
	}

	@Override
	void readClient(int id, ByteArrayDataInput data, Object[] extradata) {
		int orbalArtsid=data.readInt();
		double posX=data.readDouble();
		double posY=data.readDouble();
		double posZ=data.readDouble();
		doorbalArts(orbalArtsid,posX,posY,posZ);
	}

	private void doorbalArts(int orbalArtsid, double posX, double posY,double posZ) {
		switch(orbalArtsid){
		case OrbalArtsIdList.FireBolt:
			doFireShoot(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.FlameArrow:
			doBurningArrow(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.NapalmBreath:
			doBurningAir(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.FireBoltEX:
			doImprovedFireShoot(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.SpiralFlare:
			doHelicalInflammation(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.VolcanicRave:
			doVolcanicBlast(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Forte:
			doStimulation(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.AquaBleed:
			doWatershoot(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.BlueImpact:
			doIcyStrike(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.DiamondDust:
			doAuroraDust(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Tear:
			doHeal(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Teara:
			doMediumHeal(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Tearal:
			doMegaHeal(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.LaTear:
			doMultiHeal(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.LaTeara:
			doMultiMediumHeal(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Curia:
			doCure(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.LaCuria:
			doMultiCure(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Revive:
			doRevival(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.StoneHammer:
			doRockyHammer(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.EarthLance:
			doGeoblade(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.PetrifyBreath:
			doRockyAir(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.StoneImpact:
			doGiganticStrike(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.TitanicRoar:
			doBlusterOfTitan(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.EarthGuard:
			doEarthGuard(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.EarthWall:
			doEarthWall(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Crest:
			doCrystalDefence(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.AirStrike:
			doWindRing(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Aerial:
			doWindyZone(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.AeroStorm:
			doWindstorm(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Lightning:
			doLightningBeam(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.PlasmaWave:
			doPlasmaWave(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.SylphenGuard:
			doBlessOfAeolus(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.SylphenWing:
			doWingOfAeolus(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.SoulBlur:
			doPsychicRay(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.ShadowSpear:
			doDarkLance(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.HellGate:
			doHellGate(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.WhiteGehenna:
			doPaleHell(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.ClockUp:
			doTemporalAcceleration(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.ClockUpEX:
			doImprovedTemporalAcceleration(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.AntiSept:
			doAntiwitchZone(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.AntiSeptAll:
			doMultiAntiwitchZone(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.ChaosBrand:
			doSpotOfChaos(orbalArtsid,posX,posY,posZ);
			break;
		case OrbalArtsIdList.Saint:
			doHolyBlessing(orbalArtsid,posX,posY,posZ);
			break;
		}
		
	}

	private void doHolyBlessing(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doSpotOfChaos(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMultiAntiwitchZone(int orbalArtsid, double posX,
			double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doAntiwitchZone(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doImprovedTemporalAcceleration(int orbalArtsid, double posX,
			double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doTemporalAcceleration(int orbalArtsid, double posX,
			double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doPaleHell(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doHellGate(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doDarkLance(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doPsychicRay(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doWingOfAeolus(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doBlessOfAeolus(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doPlasmaWave(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doLightningBeam(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doWindstorm(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doWindyZone(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doWindRing(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doCrystalDefence(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doEarthWall(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doEarthGuard(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doBlusterOfTitan(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doGiganticStrike(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doRockyAir(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doGeoblade(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doRockyHammer(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doRevival(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMultiCure(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doCure(int orbalArtsid, double posX, double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMultiMediumHeal(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMultiHeal(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMegaHeal(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doMediumHeal(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doHeal(int orbalArtsid, double posX, double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doAuroraDust(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doIcyStrike(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doWatershoot(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doStimulation(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doVolcanicBlast(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doHelicalInflammation(int orbalArtsid, double posX,
			double posY, double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doImprovedFireShoot(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doBurningAir(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doBurningArrow(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		
	}

	private void doFireShoot(int orbalArtsid, double posX, double posY,
			double posZ) {
		// TODO Auto-generated method stub
		World world=FMLClientHandler.instance().getClient().theWorld;
//		OrbalRenderDrakLanceFX arrow=new OrbalRenderDrakLanceFX(world,posX,posY+5,posZ);
//		FMLClientHandler.instance().getClient().effectRenderer.addEffect(arrow);
	}

	@Override
	void readServer(int id, ByteArrayDataInput data, Object[] extradata) {
		

	}
	

}
